// A-S-M team
// Project: BattleCity
// Created: 23.03.2011
// Last change: 24.03.2011
// Description: class "Game" - logic of game

#pragma once
#include "play.h"
#include "menu.h"

class Game
{

// sigleton pattern implementation
public:
	static Game * getInstance()
	{
		if (!p_instance)
			p_instance = new Game();
		return p_instance;
	}
private:
	Game()
	{
		_game_state = GS_MENU;
		_exit = false;		

		// init Play
		Play::getInstance()->init();
	}
    Game(const Game&);  
    Game& operator=(Game&);
	static Game * p_instance;

// class itself
public:
	enum GameState {GS_MENU, GS_PLAY, GS_EDITOR};
public:
	bool update(int dt); // return false, if exit game
	void setGameState(GameState game_state) { _game_state = game_state; }
	void keyDown(int key);
	void keyUp(int key);
	void keyPress(const CL_InputEvent &key);
	void exit() { _exit = true; }
	bool getExit() { return _exit; }
private:
	GameState _game_state;
	Menu menu;
	bool _exit;
};